import 'dart:async';
import 'dart:io';

import 'package:flutter/services.dart';
import 'package:riki_push/enum/phone_platform.dart';
import 'package:riki_push/factory/riki_base_push.dart';
import 'package:riki_base_flutter/riki_base_flutter.dart';

///
///  vivo推送
///
class RikiVivoPush {
  static const MethodChannel _channel_vivo = const MethodChannel('riki_push_vivo');

  /// 初始化vivo
  static Future<void> init() async {
    return await _channel_vivo.invokeMethod('initVivo');
  }

  /// 获取vivoRid
  static Future<String> get vivoRid async {
    String vivoRegId = '';
    if (Platform.isAndroid && await RikiBasePush.phonePlatform == PhonePlatform.vivo) {
      vivoRegId = await _channel_vivo.invokeMethod('getVivoRid');
    }
    LogUtil.v("vivoRegId是" + vivoRegId);
    return vivoRegId;
  }

  /// 反初始化
  static Future<void> unInit() async {
    return await _channel_vivo.invokeMethod('unInit');
  }
}
